<?php // content="text/plain; charset=utf-8"
require_once ('jpgraph/src/jpgraph.php');
require_once ('jpgraph/src/jpgraph_bar.php');
require_once ('jpgraph/src/jpgraph_line.php');

$datay1 = array(0.2, 2.5, 4.5, 1.5, 5.7, 0.2, 2.5, 4.5, 1.5, 5.7);
$datay2 = array(32, 50, 45, 115, 157, 42, 25, 45, 250, 70);
$datay3 = array(123, 52, 54, 51, 60, 22, 52, 45, 150, 125);

// Create the graph. These two calls are always required
$graph = new Graph(350,220,'auto');
$graph->SetScale("textlin");
$graph->SetY2Scale("lin",0,300);
$graph->SetY2OrderBack(false);

//$theme_class="DefaultTheme";
//$graph->SetTheme(new $theme_class());

// set major and minor tick positions manually
$graph->yaxis->SetTickPositions(array(0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0), array(0.5, 1.5, 2.5, 3.5, 4.5, 5.5));
$graph->y2axis->SetTickPositions(array(0, 100, 200, 300));
$graph->SetBox(false);

//$graph->ygrid->SetColor('gray');
$graph->ygrid->SetFill(false);
//$graph->xaxis->SetTickLabels(array('A','B','C','D'));
$graph->yaxis->HideLine(false);
$graph->yaxis->HideTicks(false,false);

// Create the bar plots
$b1plot = new BarPlot($datay1);
$p1 = new LinePlot($datay2);
$p2 = new LinePlot($datay3);

// ...and add it to the graPH
$graph->Add($b1plot);
$graph->AddY2($p1);
$graph->AddY2($p2);

$b1plot->SetColor("green");
$b1plot->SetLegend('Sharpe');
$b1plot->SetFillGradient("green","green",GRAD_LEFT_REFLECTION);
$b1plot->SetWidth(10);

$p1->SetColor("#55bbdd");
$p1->SetLegend('Độ lệch chuẩn');
$p1->mark->SetType(MARK_FILLEDCIRCLE,'',1.0);
$p1->mark->SetColor('#55bbdd');
$p1->mark->SetFillColor('#55bbdd');
$p1->SetCenter();

$p2->SetColor("purple");
$p2->SetLegend('Lợi nhuận');
$p2->mark->SetType(MARK_UTRIANGLE,'',1.0);
$p2->mark->SetColor('#purple');
$p2->mark->SetFillColor('#purple');
$p2->value->SetMargin(14);
$p2->SetCenter();

$graph->title->Set("Thống kê theo Tỷ lệ Sharpe");

// Display the graph
$graph->Stroke();
?>
